/******************************************************************************

  File Name     : mxnet_session.h
  Version       : Initial Draft
  Author        : tongzhilin
  Created       : 2020/8/6
  Last Modified :
  Description   : mxnet_session
  Function List :
  History       :
  1.Date        : 2020/8/6
    Author      : tongzhilin
    Modification: Created file

******************************************************************************/
#pragma once
#include "mp_common.h"
#include "mxnet_model.h"

typedef enum
{
    MXNET_GPU_ID_0        = 0x0,
    MXNET_GPU_ID_1        = 0x1,
    MXNET_GPU_ID_2        = 0x2,
    MXNET_GPU_ID_3        = 0x3,
    MXNET_GPU_ID_4        = 0x4,
    MXNET_GPU_ID_5        = 0x5,
    MXNET_GPU_ID_6        = 0x6,
    MXNET_GPU_ID_7        = 0x7,

    MXNET_GPU_AUTO        = 0xFF,

    MXNET_GPU_BUTT
}MXNET_GPU_ID_E;

typedef struct
{
    float*  m_pfBlobdata;
    INT32   m_s32DataSize;  //m_s32DataSize == m_s32C * m_s32H * m_s32W * sizeof(float)
    INT32   m_s32C;
    INT32   m_s32H;
    INT32   m_s32W;
    INT32   m_s32S;
}MXNET_DATA_BLOB_S;

class MxnetSession
{
public:
    MxnetSession(MxnetModel* _pModel, bool _bTest = false);
    virtual ~MxnetSession();

    void set_input_blob(INT32 _no, MXNET_DATA_BLOB_S& _stInputDataBlob);
    void set_output_blob(INT32 _no, MXNET_DATA_BLOB_S& _stOutDataBlob);

    void execute();
    void sync();

public:
    MxnetModel*                       m_pModel;
private:
    std::vector<MXNET_DATA_BLOB_S>    m_vcOutputDataBlob;

    //session test
    bool                              m_bTest;
};

